<%@ page language="java" isErrorPage="true" import="java.util.*" pageEncoding="UTF-8"%>

<!DOCTYPE HTML PUBLIC "-//W3C//DTD HTML 4.01 Transitional//EN">
<html>
  <head>
    <title>404</title>
  </head>
  
  <%
  	Throwable th=null;//写为Throwable类型，也可以包括出现error的情况
  	if(exception!=null){
  		th=exception;
  	}else
  	if(request.getAttribute("javax.servlet.error.exception")!=null){
  				//产生jsp或servlet异常时，会setAttribute("javax.servlet.error.exception",new Exception。。。);
  				//此时是获取参数值，"javax.servlet.error.exception"是参数的键
  		th=(Throwable)request.getAttribute("javax.servlet.error.exception");
  		out.print("<h2>错误码："+request.getAttribute("javax.servlet.error.status_code")+"</h2>");
  		out.print("<h2>异常类型："+request.getAttribute("javax.servlet.error.exception_type")+"</h2>");
  		out.print("<h2>异常信息："+request.getAttribute("javax.servlet.error.message")+"</h2>");
  		out.print("<h2>请求的URI "+request.getAttribute("javax.servlet.error.request_uri")+"</h2>");
  		out.print("<h2>产生异常的servlet "+request.getAttribute("javax.servlet.error.servlet_name")+"</h2>");
  				//键为"javax.servlet.error.status_code"，值为该错误的错误码
  	}
  	if(th!=null){
  		String message=th.getMessage();
  	}
  	//sendMail(message)给工作人员发电子邮件
   %>
  
  <body>
  <p style="color:red"></p>
    <img style="width:800px;aligh:center" alt="404" src="/img/404.jpg" >
  </body>
</html>
